#ifndef __STDMYSTRING_H_
#define __STDMYSTRING_H_

#include <iostream>

class myStringList;//前置声明
class stdMyString
{
public:
    friend std::ostream& operator<<(std::ostream &os,const stdMyString& str);
    friend std::istream &operator>>(std::istream &is, stdMyString &str);

    stdMyString();
    stdMyString(const char *str);
    stdMyString(const stdMyString &str);
    ~stdMyString();

    stdMyString Number(int a);

    stdMyString operator+(const stdMyString & str);
    stdMyString operator-(const stdMyString & str);
    stdMyString& operator+=(const stdMyString & str);
    stdMyString& operator+=(const char c);

    bool operator==(const stdMyString & str);
    bool operator!=(const stdMyString & str);
    bool operator>(const stdMyString & str);

    char& operator[](int idx);
    operator int();
    operator double();

    myStringList split(const stdMyString& str);//字符串切割

    //赋值运算符的重载
    stdMyString& operator=(const stdMyString &str);

private:
    char * s;//字符串指针
    int size;//长度
    int capacity;//容量
};


std::ostream &operator<<(std::ostream &os,const stdMyString &str);
std::istream &operator>>(std::istream &is, stdMyString &str);

class myStringList
{
public:
    myStringList();
    ~myStringList();

    myStringList& operator +=(const stdMyString& str);
    myStringList& operator -=(const stdMyString& str);
    stdMyString &  operator [](int index);

    void removeByIndex(int index);

    friend std::ostream &operator<<(std::ostream &os,const myStringList &str);
   
private:
    stdMyString * string;
    int size;
    int capacity;
};
std::ostream &operator<<(std::ostream &os, const myStringList &list);



#endif